package jp.co.itfrontier.mashup.app
{
	import jp.co.itfrontier.mashup.base.BaseApplication;
	import mx.controls.Button;
	import flash.events.MouseEvent;
	import jp.co.itfrontier.mashup.core.EventController;
	import jp.co.itfrontier.mashup.event.SearchEvent;
	import mx.controls.TextInput;
	import jp.co.itfrontier.mashup.components.CustomTextInput;
	import jp.co.itfrontier.mashup.core.Logger;
	import mx.managers.CursorManager;

	public class BookExplorerCode extends BaseApplication {
		
		public var btn:Button;
		
		public var keyword:CustomTextInput;
		
		public function BookExplorerCode() {
		}

		override protected function childrenCreated():void {
			super.childrenCreated();
			
			btn.addEventListener(MouseEvent.CLICK, submitHandler);
		}
		
		public function submitHandler(event:MouseEvent = null):void {
			
			var searchEvent:SearchEvent = new SearchEvent(SearchEvent.SEARCH);

			if (!keyword.isDefault() && keyword.text.length > 0) {
	
				Logger.getInstance().info("検索開始" + keyword.text);
	
				searchEvent.setData("keyword", keyword.text);

				CursorManager.setBusyCursor();
	
				EventController.dispathEvent(searchEvent);
			}
		}
		
	}
}